package c.e.a.b.f.b;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class s4<V> extends FutureTask<V> implements Comparable<s4<V>> {
    public final long a;
    public final boolean b;
    public final String c;
    public final /* synthetic */ r4 d;

    public s4(r4 r4Var, Callable<V> callable, boolean z, String str) {
        this.d = r4Var;
        super(callable);
        long andIncrement = r4.k.getAndIncrement();
        this.a = andIncrement;
        this.c = str;
        this.b = z;
        if (andIncrement == Long.MAX_VALUE) {
            r4Var.d().f.a("Tasks index overflow");
        }
    }

    public final int compareTo(Object obj) {
        s4 s4Var = (s4) obj;
        boolean z = this.b;
        if (z != s4Var.b) {
            return z ? -1 : 1;
        } else {
            long j = this.a;
            long j2 = s4Var.a;
            if (j < j2) {
                return -1;
            }
            if (j > j2) {
                return 1;
            }
            this.d.d().g.b("Two tasks share the same index. index", Long.valueOf(this.a));
            return 0;
        }
    }

    public final void setException(Throwable th) {
        this.d.d().f.b(this.c, th);
        super.setException(th);
    }

    public s4(r4 r4Var, Runnable runnable, boolean z, String str) {
        this.d = r4Var;
        super(runnable, null);
        long andIncrement = r4.k.getAndIncrement();
        this.a = andIncrement;
        this.c = str;
        this.b = z;
        if (andIncrement == Long.MAX_VALUE) {
            r4Var.d().f.a("Tasks index overflow");
        }
    }
}
